home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / gcc-2.6.3-bin.lha / GNU / info / gcc.info-22 (.txt) < prev    next >
GNU Info File  |  1995-03-30  |  44KB  |  788 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.55 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993, 1994 Free Software Foundation,
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License," "Funding for
  13. Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are
  14. included exactly as in the original, and provided that the entire
  15. resulting derived work is distributed under the terms of a permission
  16. notice identical to this one.
  17.    Permission is granted to copy and distribute translations of this
  18. manual into another language, under the above conditions for modified
  19. versions, except that the sections entitled "GNU General Public
  20. License," "Funding for Free Software," and "Protect Your Freedom--Fight
  21. `Look And Feel'", and this permission notice, may be included in
  22. translations approved by the Free Software Foundation instead of in the
  23. original English.
  24. File: gcc.info,  Node: Initialization,  Next: Macros for Initialization,  Prev: Label Output,  Up: Assembler Format
  25. How Initialization Functions Are Handled
  26. ----------------------------------------
  27.    The compiled code for certain languages includes "constructors"
  28. (also called "initialization routines")--functions to initialize data
  29. in the program when the program is started.  These functions need to be
  30. called before the program is "started"--that is to say, before `main'
  31. is called.
  32.    Compiling some languages generates "destructors" (also called
  33. "termination routines") that should be called when the program
  34. terminates.
  35.    To make the initialization and termination functions work, the
  36. compiler must output something in the assembler code to cause those
  37. functions to be called at the appropriate time.  When you port the
  38. compiler to a new system, you need to specify how to do this.
  39.    There are two major ways that GCC currently supports the execution of
  40. initialization and termination functions.  Each way has two variants.
  41. Much of the structure is common to all four variations.
  42.    The linker must build two lists of these functions--a list of
  43. initialization functions, called `__CTOR_LIST__', and a list of
  44. termination functions, called `__DTOR_LIST__'.
  45.    Each list always begins with an ignored function pointer (which may
  46. hold 0, -1, or a count of the function pointers after it, depending on
  47. the environment).  This is followed by a series of zero or more function
  48. pointers to constructors (or destructors), followed by a function
  49. pointer containing zero.
  50.    Depending on the operating system and its executable file format,
  51. either `crtstuff.c' or `libgcc2.c' traverses these lists at startup
  52. time and exit time.  Constructors are called in forward order of the
  53. list; destructors in reverse order.
  54.    The best way to handle static constructors works only for object file
  55. formats which provide arbitrarily-named sections.  A section is set
  56. aside for a list of constructors, and another for a list of destructors.
  57. Traditionally these are called `.ctors' and `.dtors'.  Each object file
  58. that defines an initialization function also puts a word in the
  59. constructor section to point to that function.  The linker accumulates
  60. all these words into one contiguous `.ctors' section.  Termination
  61. functions are handled similarly.
  62.    To use this method, you need appropriate definitions of the macros
  63. `ASM_OUTPUT_CONSTRUCTOR' and `ASM_OUTPUT_DESTRUCTOR'.  Usually you can
  64. get them by including `svr4.h'.
  65.    When arbitrary sections are available, there are two variants,
  66. depending upon how the code in `crtstuff.c' is called.  On systems that
  67. support an "init" section which is executed at program startup, parts
  68. of `crtstuff.c' are compiled into that section.  The program is linked
  69. by the `gcc' driver like this:
  70.      ld -o OUTPUT_FILE crtbegin.o ... crtend.o -lgcc
  71.    The head of a function (`__do_global_ctors') appears in the init
  72. section of `crtbegin.o'; the remainder of the function appears in the
  73. init section of `crtend.o'.  The linker will pull these two parts of
  74. the section together, making a whole function.  If any of the user's
  75. object files linked into the middle of it contribute code, then that
  76. code will be executed as part of the body of `__do_global_ctors'.
  77.    To use this variant, you must define the `INIT_SECTION_ASM_OP' macro
  78. properly.
  79.    If no init section is available, do not define
  80. `INIT_SECTION_ASM_OP'.  Then `__do_global_ctors' is built into the text
  81. section like all other functions, and resides in `libgcc.a'.  When GCC
  82. compiles any function called `main', it inserts a procedure call to
  83. `__main' as the first executable code after the function prologue.  The
  84. `__main' function, also defined in `libgcc2.c', simply calls
  85. `__do_global_ctors'.
  86.    In file formats that don't support arbitrary sections, there are
  87. again two variants.  In the simplest variant, the GNU linker (GNU `ld')
  88. and an `a.out' format must be used.  In this case,
  89. `ASM_OUTPUT_CONSTRUCTOR' is defined to produce a `.stabs' entry of type
  90. `N_SETT', referencing the name `__CTOR_LIST__', and with the address of
  91. the void function containing the initialization code as its value.  The
  92. GNU linker recognizes this as a request to add the value to a "set";
  93. the values are accumulated, and are eventually placed in the executable
  94. as a vector in the format described above, with a leading (ignored)
  95. count and a trailing zero element.  `ASM_OUTPUT_DESTRUCTOR' is handled
  96. similarly.  Since no init section is available, the absence of
  97. `INIT_SECTION_ASM_OP' causes the compilation of `main' to call `__main'
  98. as above, starting the initialization process.
  99.    The last variant uses neither arbitrary sections nor the GNU linker.
  100. This is preferable when you want to do dynamic linking and when using
  101. file formats which the GNU linker does not support, such as `ECOFF'.  In
  102. this case, `ASM_OUTPUT_CONSTRUCTOR' does not produce an `N_SETT'
  103. symbol; initialization and termination functions are recognized simply
  104. by their names.  This requires an extra program in the linkage step,
  105. called `collect2'.  This program pretends to be the linker, for use
  106. with GNU CC; it does its job by running the ordinary linker, but also
  107. arranges to include the vectors of initialization and termination
  108. functions.  These functions are called via `__main' as described above.
  109.    Choosing among these configuration options has been simplified by a
  110. set of operating-system-dependent files in the `config' subdirectory.
  111. These files define all of the relevant parameters.  Usually it is
  112. sufficient to include one into your specific machine-dependent
  113. configuration file.  These files are:
  114. `aoutos.h'
  115.      For operating systems using the `a.out' format.
  116. `next.h'
  117.      For operating systems using the `MachO' format.
  118. `svr3.h'
  119.      For System V Release 3 and similar systems using `COFF' format.
  120. `svr4.h'
  121.      For System V Release 4 and similar systems using `ELF' format.
  122. `vms.h'
  123.      For the VMS operating system.
  124.    The following section describes the specific macros that control and
  125. customize the handling of initialization and termination functions.
  126. File: gcc.info,  Node: Macros for Initialization,  Next: Instruction Output,  Prev: Initialization,  Up: Assembler Format
  127. Macros Controlling Initialization Routines
  128. ------------------------------------------
  129.    Here are the macros that control how the compiler handles
  130. initialization and termination functions:
  131. `INIT_SECTION_ASM_OP'
  132.      If defined, a C string constant for the assembler operation to
  133.      identify the following data as initialization code.  If not
  134.      defined, GNU CC will assume such a section does not exist.  When
  135.      you are using special sections for initialization and termination
  136.      functions, this macro also controls how `crtstuff.c' and
  137.      `libgcc2.c' arrange to run the initialization functions.
  138. `HAS_INIT_SECTION'
  139.      If defined, `main' will not call `__main' as described above.
  140.      This macro should be defined for systems that control the contents
  141.      of the init section on a symbol-by-symbol basis, such as OSF/1,
  142.      and should not be defined explicitly for systems that support
  143.      `INIT_SECTION_ASM_OP'.
  144. `INVOKE__main'
  145.      If defined, `main' will call `__main' despite the presence of
  146.      `INIT_SECTION_ASM_OP'.  This macro should be defined for systems
  147.      where the init section is not actually run automatically, but is
  148.      still useful for collecting the lists of constructors and
  149.      destructors.
  150. `ASM_OUTPUT_CONSTRUCTOR (STREAM, NAME)'
  151.      Define this macro as a C statement to output on the stream STREAM
  152.      the assembler code to arrange to call the function named NAME at
  153.      initialization time.
  154.      Assume that NAME is the name of a C function generated
  155.      automatically by the compiler.  This function takes no arguments.
  156.      Use the function `assemble_name' to output the name NAME; this
  157.      performs any system-specific syntactic transformations such as
  158.      adding an underscore.
  159.      If you don't define this macro, nothing special is output to
  160.      arrange to call the function.  This is correct when the function
  161.      will be called in some other manner--for example, by means of the
  162.      `collect2' program, which looks through the symbol table to find
  163.      these functions by their names.
  164. `ASM_OUTPUT_DESTRUCTOR (STREAM, NAME)'
  165.      This is like `ASM_OUTPUT_CONSTRUCTOR' but used for termination
  166.      functions rather than initialization functions.
  167.    If your system uses `collect2' as the means of processing
  168. constructors, then that program normally uses `nm' to scan an object
  169. file for constructor functions to be called.  On certain kinds of
  170. systems, you can define these macros to make `collect2' work faster
  171. (and, in some cases, make it work at all):
  172. `OBJECT_FORMAT_COFF'
  173.      Define this macro if the system uses COFF (Common Object File
  174.      Format) object files, so that `collect2' can assume this format
  175.      and scan object files directly for dynamic constructor/destructor
  176.      functions.
  177. `OBJECT_FORMAT_ROSE'
  178.      Define this macro if the system uses ROSE format object files, so
  179.      that `collect2' can assume this format and scan object files
  180.      directly for dynamic constructor/destructor functions.
  181. `REAL_NM_FILE_NAME'
  182.      Define this macro as a C string constant containing the file name
  183.      to use to execute `nm'.  The default is to search the path
  184.      normally for `nm'.
  185.    These macros are effective only in a native compiler; `collect2' as
  186. part of a cross compiler always uses `nm' for the target machine.
  187. File: gcc.info,  Node: Instruction Output,  Next: Dispatch Tables,  Prev: Macros for Initialization,  Up: Assembler Format
  188. Output of Assembler Instructions
  189. --------------------------------
  190.    This describes assembler instruction output.
  191. `REGISTER_NAMES'
  192.      A C initializer containing the assembler's names for the machine
  193.      registers, each one as a C string constant.  This is what
  194.      translates register numbers in the compiler into assembler
  195.      language.
  196. `ADDITIONAL_REGISTER_NAMES'
  197.      If defined, a C initializer for an array of structures containing
  198.      a name and a register number.  This macro defines additional names
  199.      for hard registers, thus allowing the `asm' option in declarations
  200.      to refer to registers using alternate names.
  201. `ASM_OUTPUT_OPCODE (STREAM, PTR)'
  202.      Define this macro if you are using an unusual assembler that
  203.      requires different names for the machine instructions.
  204.      The definition is a C statement or statements which output an
  205.      assembler instruction opcode to the stdio stream STREAM.  The
  206.      macro-operand PTR is a variable of type `char *' which points to
  207.      the opcode name in its "internal" form--the form that is written
  208.      in the machine description.  The definition should output the
  209.      opcode name to STREAM, performing any translation you desire, and
  210.      increment the variable PTR to point at the end of the opcode so
  211.      that it will not be output twice.
  212.      In fact, your macro definition may process less than the entire
  213.      opcode name, or more than the opcode name; but if you want to
  214.      process text that includes `%'-sequences to substitute operands,
  215.      you must take care of the substitution yourself.  Just be sure to
  216.      increment PTR over whatever text should not be output normally.
  217.      If you need to look at the operand values, they can be found as the
  218.      elements of `recog_operand'.
  219.      If the macro definition does nothing, the instruction is output in
  220.      the usual way.
  221. `FINAL_PRESCAN_INSN (INSN, OPVEC, NOPERANDS)'
  222.      If defined, a C statement to be executed just prior to the output
  223.      of assembler code for INSN, to modify the extracted operands so
  224.      they will be output differently.
  225.      Here the argument OPVEC is the vector containing the operands
  226.      extracted from INSN, and NOPERANDS is the number of elements of
  227.      the vector which contain meaningful data for this insn.  The
  228.      contents of this vector are what will be used to convert the insn
  229.      template into assembler code, so you can change the assembler
  230.      output by changing the contents of the vector.
  231.      This macro is useful when various assembler syntaxes share a single
  232.      file of instruction patterns; by defining this macro differently,
  233.      you can cause a large class of instructions to be output
  234.      differently (such as with rearranged operands).  Naturally,
  235.      variations in assembler syntax affecting individual insn patterns
  236.      ought to be handled by writing conditional output routines in
  237.      those patterns.
  238.      If this macro is not defined, it is equivalent to a null statement.
  239. `PRINT_OPERAND (STREAM, X, CODE)'
  240.      A C compound statement to output to stdio stream STREAM the
  241.      assembler syntax for an instruction operand X.  X is an RTL
  242.      expression.
  243.      CODE is a value that can be used to specify one of several ways of
  244.      printing the operand.  It is used when identical operands must be
  245.      printed differently depending on the context.  CODE comes from the
  246.      `%' specification that was used to request printing of the
  247.      operand.  If the specification was just `%DIGIT' then CODE is 0;
  248.      if the specification was `%LTR DIGIT' then CODE is the ASCII code
  249.      for LTR.
  250.      If X is a register, this macro should print the register's name.
  251.      The names can be found in an array `reg_names' whose type is `char
  252.      *[]'.  `reg_names' is initialized from `REGISTER_NAMES'.
  253.      When the machine description has a specification `%PUNCT' (a `%'
  254.      followed by a punctuation character), this macro is called with a
  255.      null pointer for X and the punctuation character for CODE.
  256. `PRINT_OPERAND_PUNCT_VALID_P (CODE)'
  257.      A C expression which evaluates to true if CODE is a valid
  258.      punctuation character for use in the `PRINT_OPERAND' macro.  If
  259.      `PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no
  260.      punctuation characters (except for the standard one, `%') are used
  261.      in this way.
  262. `PRINT_OPERAND_ADDRESS (STREAM, X)'
  263.      A C compound statement to output to stdio stream STREAM the
  264.      assembler syntax for an instruction operand that is a memory
  265.      reference whose address is X.  X is an RTL expression.
  266.      On some machines, the syntax for a symbolic address depends on the
  267.      section that the address refers to.  On these machines, define the
  268.      macro `ENCODE_SECTION_INFO' to store the information into the
  269.      `symbol_ref', and then check for it here.  *Note Assembler
  270.      Format::.
  271. `DBR_OUTPUT_SEQEND(FILE)'
  272.      A C statement, to be executed after all slot-filler instructions
  273.      have been output.  If necessary, call `dbr_sequence_length' to
  274.      determine the number of slots filled in a sequence (zero if not
  275.      currently outputting a sequence), to decide how many no-ops to
  276.      output, or whatever.
  277.      Don't define this macro if it has nothing to do, but it is helpful
  278.      in reading assembly output if the extent of the delay sequence is
  279.      made explicit (e.g. with white space).
  280.      Note that output routines for instructions with delay slots must be
  281.      prepared to deal with not being output as part of a sequence (i.e.
  282.      when the scheduling pass is not run, or when no slot fillers could
  283.      be found.)  The variable `final_sequence' is null when not
  284.      processing a sequence, otherwise it contains the `sequence' rtx
  285.      being output.
  286. `REGISTER_PREFIX'
  287. `LOCAL_LABEL_PREFIX'
  288. `USER_LABEL_PREFIX'
  289. `IMMEDIATE_PREFIX'
  290.      If defined, C string expressions to be used for the `%R', `%L',
  291.      `%U', and `%I' options of `asm_fprintf' (see `final.c').  These
  292.      are useful when a single `md' file must support multiple assembler
  293.      formats.  In that case, the various `tm.h' files can define these
  294.      macros differently.
  295. `ASSEMBLER_DIALECT'
  296.      If your target supports multiple dialects of assembler language
  297.      (such as different opcodes), define this macro as a C expression
  298.      that gives the numeric index of the assembler langauge dialect to
  299.      use, with zero as the first variant.
  300.      If this macro is defined, you may use
  301.      `{option0|option1|option2...}' constructs in the output templates
  302.      of patterns (*note Output Template::.) or in the first argument of
  303.      `asm_fprintf'.  This construct outputs `option0', `option1' or
  304.      `option2', etc., if the value of `ASSEMBLER_DIALECT' is zero, one
  305.      or two, etc.  Any special characters within these strings retain
  306.      their usual meaning.
  307.      If you do not define this macro, the characters `{', `|' and `}'
  308.      do not have any special meaning when used in templates or operands
  309.      to `asm_fprintf'.
  310.      Define the macros `REGISTER_PREFIX', `LOCAL_LABEL_PREFIX',
  311.      `USER_LABEL_PREFIX' and `IMMEDIATE_PREFIX' if you can express the
  312.      variations in assemble language syntax with that mechanism.  Define
  313.      `ASSEMBLER_DIALECT' and use the `{option0|option1}' syntax if the
  314.      syntax variant are larger and involve such things as different
  315.      opcodes or operand order.
  316. `ASM_OUTPUT_REG_PUSH (STREAM, REGNO)'
  317.      A C expression to output to STREAM some assembler code which will
  318.      push hard register number REGNO onto the stack.  The code need not
  319.      be optimal, since this macro is used only when profiling.
  320. `ASM_OUTPUT_REG_POP (STREAM, REGNO)'
  321.      A C expression to output to STREAM some assembler code which will
  322.      pop hard register number REGNO off of the stack.  The code need
  323.      not be optimal, since this macro is used only when profiling.
  324. File: gcc.info,  Node: Dispatch Tables,  Next: Alignment Output,  Prev: Instruction Output,  Up: Assembler Format
  325. Output of Dispatch Tables
  326. -------------------------
  327.    This concerns dispatch tables.
  328. `ASM_OUTPUT_ADDR_DIFF_ELT (STREAM, VALUE, REL)'
  329.      This macro should be provided on machines where the addresses in a
  330.      dispatch table are relative to the table's own address.
  331.      The definition should be a C statement to output to the stdio
  332.      stream STREAM an assembler pseudo-instruction to generate a
  333.      difference between two labels.  VALUE and REL are the numbers of
  334.      two internal labels.  The definitions of these labels are output
  335.      using `ASM_OUTPUT_INTERNAL_LABEL', and they must be printed in the
  336.      same way here.  For example,
  337.           fprintf (STREAM, "\t.word L%d-L%d\n",
  338.                    VALUE, REL)
  339. `ASM_OUTPUT_ADDR_VEC_ELT (STREAM, VALUE)'
  340.      This macro should be provided on machines where the addresses in a
  341.      dispatch table are absolute.
  342.      The definition should be a C statement to output to the stdio
  343.      stream STREAM an assembler pseudo-instruction to generate a
  344.      reference to a label.  VALUE is the number of an internal label
  345.      whose definition is output using `ASM_OUTPUT_INTERNAL_LABEL'.  For
  346.      example,
  347.           fprintf (STREAM, "\t.word L%d\n", VALUE)
  348. `ASM_OUTPUT_CASE_LABEL (STREAM, PREFIX, NUM, TABLE)'
  349.      Define this if the label before a jump-table needs to be output
  350.      specially.  The first three arguments are the same as for
  351.      `ASM_OUTPUT_INTERNAL_LABEL'; the fourth argument is the jump-table
  352.      which follows (a `jump_insn' containing an `addr_vec' or
  353.      `addr_diff_vec').
  354.      This feature is used on system V to output a `swbeg' statement for
  355.      the table.
  356.      If this macro is not defined, these labels are output with
  357.      `ASM_OUTPUT_INTERNAL_LABEL'.
  358. `ASM_OUTPUT_CASE_END (STREAM, NUM, TABLE)'
  359.      Define this if something special must be output at the end of a
  360.      jump-table.  The definition should be a C statement to be executed
  361.      after the assembler code for the table is written.  It should write
  362.      the appropriate code to stdio stream STREAM.  The argument TABLE
  363.      is the jump-table insn, and NUM is the label-number of the
  364.      preceding label.
  365.      If this macro is not defined, nothing special is output at the end
  366.      of the jump-table.
  367. File: gcc.info,  Node: Alignment Output,  Prev: Dispatch Tables,  Up: Assembler Format
  368. Assembler Commands for Alignment
  369. --------------------------------
  370.    This describes commands for alignment.
  371. `ASM_OUTPUT_ALIGN_CODE (FILE)'
  372.      A C expression to output text to align the location counter in the
  373.      way that is desirable at a point in the code that is reached only
  374.      by jumping.
  375.      This macro need not be defined if you don't want any special
  376.      alignment to be done at such a time.  Most machine descriptions do
  377.      not currently define the macro.
  378. `ASM_OUTPUT_LOOP_ALIGN (FILE)'
  379.      A C expression to output text to align the location counter in the
  380.      way that is desirable at the beginning of a loop.
  381.      This macro need not be defined if you don't want any special
  382.      alignment to be done at such a time.  Most machine descriptions do
  383.      not currently define the macro.
  384. `ASM_OUTPUT_SKIP (STREAM, NBYTES)'
  385.      A C statement to output to the stdio stream STREAM an assembler
  386.      instruction to advance the location counter by NBYTES bytes.
  387.      Those bytes should be zero when loaded.  NBYTES will be a C
  388.      expression of type `int'.
  389. `ASM_NO_SKIP_IN_TEXT'
  390.      Define this macro if `ASM_OUTPUT_SKIP' should not be used in the
  391.      text section because it fails put zeros in the bytes that are
  392.      skipped.  This is true on many Unix systems, where the pseudo-op
  393.      to skip bytes produces no-op instructions rather than zeros when
  394.      used in the text section.
  395. `ASM_OUTPUT_ALIGN (STREAM, POWER)'
  396.      A C statement to output to the stdio stream STREAM an assembler
  397.      command to advance the location counter to a multiple of 2 to the
  398.      POWER bytes.  POWER will be a C expression of type `int'.
  399. File: gcc.info,  Node: Debugging Info,  Next: Cross-compilation,  Prev: Assembler Format,  Up: Target Macros
  400. Controlling Debugging Information Format
  401. ========================================
  402.    This describes how to specify debugging information.
  403. * Menu:
  404. * All Debuggers::      Macros that affect all debugging formats uniformly.
  405. * DBX Options::        Macros enabling specific options in DBX format.
  406. * DBX Hooks::          Hook macros for varying DBX format.
  407. * File Names and DBX:: Macros controlling output of file names in DBX format.
  408. * SDB and DWARF::      Macros for SDB (COFF) and DWARF formats.
  409. File: gcc.info,  Node: All Debuggers,  Next: DBX Options,  Up: Debugging Info
  410. Macros Affecting All Debugging Formats
  411. --------------------------------------
  412.    These macros affect all debugging formats.
  413. `DBX_REGISTER_NUMBER (REGNO)'
  414.      A C expression that returns the DBX register number for the
  415.      compiler register number REGNO.  In simple cases, the value of this
  416.      expression may be REGNO itself.  But sometimes there are some
  417.      registers that the compiler knows about and DBX does not, or vice
  418.      versa.  In such cases, some register may need to have one number in
  419.      the compiler and another for DBX.
  420.      If two registers have consecutive numbers inside GNU CC, and they
  421.      can be used as a pair to hold a multiword value, then they *must*
  422.      have consecutive numbers after renumbering with
  423.      `DBX_REGISTER_NUMBER'.  Otherwise, debuggers will be unable to
  424.      access such a pair, because they expect register pairs to be
  425.      consecutive in their own numbering scheme.
  426.      If you find yourself defining `DBX_REGISTER_NUMBER' in way that
  427.      does not preserve register pairs, then what you must do instead is
  428.      redefine the actual register numbering scheme.
  429. `DEBUGGER_AUTO_OFFSET (X)'
  430.      A C expression that returns the integer offset value for an
  431.      automatic variable having address X (an RTL expression).  The
  432.      default computation assumes that X is based on the frame-pointer
  433.      and gives the offset from the frame-pointer.  This is required for
  434.      targets that produce debugging output for DBX or COFF-style
  435.      debugging output for SDB and allow the frame-pointer to be
  436.      eliminated when the `-g' options is used.
  437. `DEBUGGER_ARG_OFFSET (OFFSET, X)'
  438.      A C expression that returns the integer offset value for an
  439.      argument having address X (an RTL expression).  The nominal offset
  440.      is OFFSET.
  441. `PREFERRED_DEBUGGING_TYPE'
  442.      A C expression that returns the type of debugging output GNU CC
  443.      produces when the user specifies `-g' or `-ggdb'.  Define this if
  444.      you have arranged for GNU CC to support more than one format of
  445.      debugging output.  Currently, the allowable values are `DBX_DEBUG',
  446.      `SDB_DEBUG', `DWARF_DEBUG', and `XCOFF_DEBUG'.
  447.      The value of this macro only affects the default debugging output;
  448.      the user can always get a specific type of output by using
  449.      `-gstabs', `-gcoff', `-gdwarf', or `-gxcoff'.
  450. File: gcc.info,  Node: DBX Options,  Next: DBX Hooks,  Prev: All Debuggers,  Up: Debugging Info
  451. Specific Options for DBX Output
  452. -------------------------------
  453.    These are specific options for DBX output.
  454. `DBX_DEBUGGING_INFO'
  455.      Define this macro if GNU CC should produce debugging output for DBX
  456.      in response to the `-g' option.
  457. `XCOFF_DEBUGGING_INFO'
  458.      Define this macro if GNU CC should produce XCOFF format debugging
  459.      output in response to the `-g' option.  This is a variant of DBX
  460.      format.
  461. `DEFAULT_GDB_EXTENSIONS'
  462.      Define this macro to control whether GNU CC should by default
  463.      generate GDB's extended version of DBX debugging information
  464.      (assuming DBX-format debugging information is enabled at all).  If
  465.      you don't define the macro, the default is 1: always generate the
  466.      extended information if there is any occasion to.
  467. `DEBUG_SYMS_TEXT'
  468.      Define this macro if all `.stabs' commands should be output while
  469.      in the text section.
  470. `ASM_STABS_OP'
  471.      A C string constant naming the assembler pseudo op to use instead
  472.      of `.stabs' to define an ordinary debugging symbol.  If you don't
  473.      define this macro, `.stabs' is used.  This macro applies only to
  474.      DBX debugging information format.
  475. `ASM_STABD_OP'
  476.      A C string constant naming the assembler pseudo op to use instead
  477.      of `.stabd' to define a debugging symbol whose value is the current
  478.      location.  If you don't define this macro, `.stabd' is used.  This
  479.      macro applies only to DBX debugging information format.
  480. `ASM_STABN_OP'
  481.      A C string constant naming the assembler pseudo op to use instead
  482.      of `.stabn' to define a debugging symbol with no name.  If you
  483.      don't define this macro, `.stabn' is used.  This macro applies
  484.      only to DBX debugging information format.
  485. `DBX_NO_XREFS'
  486.      Define this macro if DBX on your system does not support the
  487.      construct `xsTAGNAME'.  On some systems, this construct is used to
  488.      describe a forward reference to a structure named TAGNAME.  On
  489.      other systems, this construct is not supported at all.
  490. `DBX_CONTIN_LENGTH'
  491.      A symbol name in DBX-format debugging information is normally
  492.      continued (split into two separate `.stabs' directives) when it
  493.      exceeds a certain length (by default, 80 characters).  On some
  494.      operating systems, DBX requires this splitting; on others,
  495.      splitting must not be done.  You can inhibit splitting by defining
  496.      this macro with the value zero.  You can override the default
  497.      splitting-length by defining this macro as an expression for the
  498.      length you desire.
  499. `DBX_CONTIN_CHAR'
  500.      Normally continuation is indicated by adding a `\' character to
  501.      the end of a `.stabs' string when a continuation follows.  To use
  502.      a different character instead, define this macro as a character
  503.      constant for the character you want to use.  Do not define this
  504.      macro if backslash is correct for your system.
  505. `DBX_STATIC_STAB_DATA_SECTION'
  506.      Define this macro if it is necessary to go to the data section
  507.      before outputting the `.stabs' pseudo-op for a non-global static
  508.      variable.
  509. `DBX_TYPE_DECL_STABS_CODE'
  510.      The value to use in the "code" field of the `.stabs' directive for
  511.      a typedef.  The default is `N_LSYM'.
  512. `DBX_STATIC_CONST_VAR_CODE'
  513.      The value to use in the "code" field of the `.stabs' directive for
  514.      a static variable located in the text section.  DBX format does not
  515.      provide any "right" way to do this.  The default is `N_FUN'.
  516. `DBX_REGPARM_STABS_CODE'
  517.      The value to use in the "code" field of the `.stabs' directive for
  518.      a parameter passed in registers.  DBX format does not provide any
  519.      "right" way to do this.  The default is `N_RSYM'.
  520. `DBX_REGPARM_STABS_LETTER'
  521.      The letter to use in DBX symbol data to identify a symbol as a
  522.      parameter passed in registers.  DBX format does not customarily
  523.      provide any way to do this.  The default is `'P''.
  524. `DBX_MEMPARM_STABS_LETTER'
  525.      The letter to use in DBX symbol data to identify a symbol as a
  526.      stack parameter.  The default is `'p''.
  527. `DBX_FUNCTION_FIRST'
  528.      Define this macro if the DBX information for a function and its
  529.      arguments should precede the assembler code for the function.
  530.      Normally, in DBX format, the debugging information entirely
  531.      follows the assembler code.
  532. `DBX_LBRAC_FIRST'
  533.      Define this macro if the `N_LBRAC' symbol for a block should
  534.      precede the debugging information for variables and functions
  535.      defined in that block.  Normally, in DBX format, the `N_LBRAC'
  536.      symbol comes first.
  537. `DBX_BLOCKS_FUNCTION_RELATIVE'
  538.      Define this macro if the value of a symbol describing the scope of
  539.      a block (`N_LBRAC' or `N_RBRAC') should be relative to the start
  540.      of the enclosing function.  Normally, GNU C uses an absolute
  541.      address.
  542. File: gcc.info,  Node: DBX Hooks,  Next: File Names and DBX,  Prev: DBX Options,  Up: Debugging Info
  543. Open-Ended Hooks for DBX Format
  544. -------------------------------
  545.    These are hooks for DBX format.
  546. `DBX_OUTPUT_LBRAC (STREAM, NAME)'
  547.      Define this macro to say how to output to STREAM the debugging
  548.      information for the start of a scope level for variable names.  The
  549.      argument NAME is the name of an assembler symbol (for use with
  550.      `assemble_name') whose value is the address where the scope begins.
  551. `DBX_OUTPUT_RBRAC (STREAM, NAME)'
  552.      Like `DBX_OUTPUT_LBRAC', but for the end of a scope level.
  553. `DBX_OUTPUT_ENUM (STREAM, TYPE)'
  554.      Define this macro if the target machine requires special handling
  555.      to output an enumeration type.  The definition should be a C
  556.      statement (sans semicolon) to output the appropriate information
  557.      to STREAM for the type TYPE.
  558. `DBX_OUTPUT_FUNCTION_END (STREAM, FUNCTION)'
  559.      Define this macro if the target machine requires special output at
  560.      the end of the debugging information for a function.  The
  561.      definition should be a C statement (sans semicolon) to output the
  562.      appropriate information to STREAM.  FUNCTION is the
  563.      `FUNCTION_DECL' node for the function.
  564. `DBX_OUTPUT_STANDARD_TYPES (SYMS)'
  565.      Define this macro if you need to control the order of output of the
  566.      standard data types at the beginning of compilation.  The argument
  567.      SYMS is a `tree' which is a chain of all the predefined global
  568.      symbols, including names of data types.
  569.      Normally, DBX output starts with definitions of the types for
  570.      integers and characters, followed by all the other predefined
  571.      types of the particular language in no particular order.
  572.      On some machines, it is necessary to output different particular
  573.      types first.  To do this, define `DBX_OUTPUT_STANDARD_TYPES' to
  574.      output those symbols in the necessary order.  Any predefined types
  575.      that you don't explicitly output will be output afterward in no
  576.      particular order.
  577.      Be careful not to define this macro so that it works only for C.
  578.      There are no global variables to access most of the built-in
  579.      types, because another language may have another set of types.
  580.      The way to output a particular type is to look through SYMS to see
  581.      if you can find it.  Here is an example:
  582.           {
  583.             tree decl;
  584.             for (decl = syms; decl; decl = TREE_CHAIN (decl))
  585.               if (!strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)),
  586.                            "long int"))
  587.                 dbxout_symbol (decl);
  588.             ...
  589.           }
  590.      This does nothing if the expected type does not exist.
  591.      See the function `init_decl_processing' in `c-decl.c' to find the
  592.      names to use for all the built-in C types.
  593.      Here is another way of finding a particular type:
  594.           {
  595.             tree decl;
  596.             for (decl = syms; decl; decl = TREE_CHAIN (decl))
  597.               if (TREE_CODE (decl) == TYPE_DECL
  598.                   && (TREE_CODE (TREE_TYPE (decl))
  599.                       == INTEGER_CST)
  600.                   && TYPE_PRECISION (TREE_TYPE (decl)) == 16
  601.                   && TYPE_UNSIGNED (TREE_TYPE (decl)))
  602.           /* This must be `unsigned short'.  */
  603.                 dbxout_symbol (decl);
  604.             ...
  605.           }
  606. File: gcc.info,  Node: File Names and DBX,  Next: SDB and DWARF,  Prev: DBX Hooks,  Up: Debugging Info
  607. File Names in DBX Format
  608. ------------------------
  609.    This describes file names in DBX format.
  610. `DBX_WORKING_DIRECTORY'
  611.      Define this if DBX wants to have the current directory recorded in
  612.      each object file.
  613.      Note that the working directory is always recorded if GDB
  614.      extensions are enabled.
  615. `DBX_OUTPUT_MAIN_SOURCE_FILENAME (STREAM, NAME)'
  616.      A C statement to output DBX debugging information to the stdio
  617.      stream STREAM which indicates that file NAME is the main source
  618.      file--the file specified as the input file for compilation.  This
  619.      macro is called only once, at the beginning of compilation.
  620.      This macro need not be defined if the standard form of output for
  621.      DBX debugging information is appropriate.
  622. `DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (STREAM, NAME)'
  623.      A C statement to output DBX debugging information to the stdio
  624.      stream STREAM which indicates that the current directory during
  625.      compilation is named NAME.
  626.      This macro need not be defined if the standard form of output for
  627.      DBX debugging information is appropriate.
  628. `DBX_OUTPUT_MAIN_SOURCE_FILE_END (STREAM, NAME)'
  629.      A C statement to output DBX debugging information at the end of
  630.      compilation of the main source file NAME.
  631.      If you don't define this macro, nothing special is output at the
  632.      end of compilation, which is correct for most machines.
  633. `DBX_OUTPUT_SOURCE_FILENAME (STREAM, NAME)'
  634.      A C statement to output DBX debugging information to the stdio
  635.      stream STREAM which indicates that file NAME is the current source
  636.      file.  This output is generated each time input shifts to a
  637.      different source file as a result of `#include', the end of an
  638.      included file, or a `#line' command.
  639.      This macro need not be defined if the standard form of output for
  640.      DBX debugging information is appropriate.
  641. File: gcc.info,  Node: SDB and DWARF,  Prev: File Names and DBX,  Up: Debugging Info
  642. Macros for SDB and DWARF Output
  643. -------------------------------
  644.    Here are macros for SDB and DWARF output.
  645. `SDB_DEBUGGING_INFO'
  646.      Define this macro if GNU CC should produce COFF-style debugging
  647.      output for SDB in response to the `-g' option.
  648. `DWARF_DEBUGGING_INFO'
  649.      Define this macro if GNU CC should produce dwarf format debugging
  650.      output in response to the `-g' option.
  651. `PUT_SDB_...'
  652.      Define these macros to override the assembler syntax for the
  653.      special SDB assembler directives.  See `sdbout.c' for a list of
  654.      these macros and their arguments.  If the standard syntax is used,
  655.      you need not define them yourself.
  656. `SDB_DELIM'
  657.      Some assemblers do not support a semicolon as a delimiter, even
  658.      between SDB assembler directives.  In that case, define this macro
  659.      to be the delimiter to use (usually `\n').  It is not necessary to
  660.      define a new set of `PUT_SDB_OP' macros if this is the only change
  661.      required.
  662. `SDB_GENERATE_FAKE'
  663.      Define this macro to override the usual method of constructing a
  664.      dummy name for anonymous structure and union types.  See
  665.      `sdbout.c' for more information.
  666. `SDB_ALLOW_UNKNOWN_REFERENCES'
  667.      Define this macro to allow references to unknown structure, union,
  668.      or enumeration tags to be emitted.  Standard COFF does not allow
  669.      handling of unknown references, MIPS ECOFF has support for it.
  670. `SDB_ALLOW_FORWARD_REFERENCES'
  671.      Define this macro to allow references to structure, union, or
  672.      enumeration tags that have not yet been seen to be handled.  Some
  673.      assemblers choke if forward tags are used, while some require it.
  674. File: gcc.info,  Node: Cross-compilation,  Next: Misc,  Prev: Debugging Info,  Up: Target Macros
  675. Cross Compilation and Floating Point
  676. ====================================
  677.    While all modern machines use 2's complement representation for
  678. integers, there are a variety of representations for floating point
  679. numbers.  This means that in a cross-compiler the representation of
  680. floating point numbers in the compiled program may be different from
  681. that used in the machine doing the compilation.
  682.    Because different representation systems may offer different amounts
  683. of range and precision, the cross compiler cannot safely use the host
  684. machine's floating point arithmetic.  Therefore, floating point
  685. constants must be represented in the target machine's format.  This
  686. means that the cross compiler cannot use `atof' to parse a floating
  687. point constant; it must have its own special routine to use instead.
  688. Also, constant folding must emulate the target machine's arithmetic (or
  689. must not be done at all).
  690.    The macros in the following table should be defined only if you are
  691. cross compiling between different floating point formats.
  692.    Otherwise, don't define them.  Then default definitions will be set
  693. up which use `double' as the data type, `==' to test for equality, etc.
  694.    You don't need to worry about how many times you use an operand of
  695. any of these macros.  The compiler never uses operands which have side
  696. effects.
  697. `REAL_VALUE_TYPE'
  698.      A macro for the C data type to be used to hold a floating point
  699.      value in the target machine's format.  Typically this would be a
  700.      `struct' containing an array of `int'.
  701. `REAL_VALUES_EQUAL (X, Y)'
  702.      A macro for a C expression which compares for equality the two
  703.      values, X and Y, both of type `REAL_VALUE_TYPE'.
  704. `REAL_VALUES_LESS (X, Y)'
  705.      A macro for a C expression which tests whether X is less than Y,
  706.      both values being of type `REAL_VALUE_TYPE' and interpreted as
  707.      floating point numbers in the target machine's representation.
  708. `REAL_VALUE_LDEXP (X, SCALE)'
  709.      A macro for a C expression which performs the standard library
  710.      function `ldexp', but using the target machine's floating point
  711.      representation.  Both X and the value of the expression have type
  712.      `REAL_VALUE_TYPE'.  The second argument, SCALE, is an integer.
  713. `REAL_VALUE_FIX (X)'
  714.      A macro whose definition is a C expression to convert the
  715.      target-machine floating point value X to a signed integer.  X has
  716.      type `REAL_VALUE_TYPE'.
  717. `REAL_VALUE_UNSIGNED_FIX (X)'
  718.      A macro whose definition is a C expression to convert the
  719.      target-machine floating point value X to an unsigned integer.  X
  720.      has type `REAL_VALUE_TYPE'.
  721. `REAL_VALUE_RNDZINT (X)'
  722.      A macro whose definition is a C expression to round the
  723.      target-machine floating point value X towards zero to an integer
  724.      value (but still as a floating point number).  X has type
  725.      `REAL_VALUE_TYPE', and so does the value.
  726. `REAL_VALUE_UNSIGNED_RNDZINT (X)'
  727.      A macro whose definition is a C expression to round the
  728.      target-machine floating point value X towards zero to an unsigned
  729.      integer value (but still represented as a floating point number).
  730.      x has type `REAL_VALUE_TYPE', and so does the value.
  731. `REAL_VALUE_ATOF (STRING, MODE)'
  732.      A macro for a C expression which converts STRING, an expression of
  733.      type `char *', into a floating point number in the target machine's
  734.      representation for mode MODE.  The value has type
  735.      `REAL_VALUE_TYPE'.
  736. `REAL_INFINITY'
  737.      Define this macro if infinity is a possible floating point value,
  738.      and therefore division by 0 is legitimate.
  739. `REAL_VALUE_ISINF (X)'
  740.      A macro for a C expression which determines whether X, a floating
  741.      point value, is infinity.  The value has type `int'.  By default,
  742.      this is defined to call `isinf'.
  743. `REAL_VALUE_ISNAN (X)'
  744.      A macro for a C expression which determines whether X, a floating
  745.      point value, is a "nan" (not-a-number).  The value has type `int'.
  746.      By default, this is defined to call `isnan'.
  747.    Define the following additional macros if you want to make floating
  748. point constant folding work while cross compiling.  If you don't define
  749. them, cross compilation is still possible, but constant folding will
  750. not happen for floating point values.
  751. `REAL_ARITHMETIC (OUTPUT, CODE, X, Y)'
  752.      A macro for a C statement which calculates an arithmetic operation
  753.      of the two floating point values X and Y, both of type
  754.      `REAL_VALUE_TYPE' in the target machine's representation, to
  755.      produce a result of the same type and representation which is
  756.      stored in OUTPUT (which will be a variable).
  757.      The operation to be performed is specified by CODE, a tree code
  758.      which will always be one of the following: `PLUS_EXPR',
  759.      `MINUS_EXPR', `MULT_EXPR', `RDIV_EXPR', `MAX_EXPR', `MIN_EXPR'.
  760.      The expansion of this macro is responsible for checking for
  761.      overflow.  If overflow happens, the macro expansion should execute
  762.      the statement `return 0;', which indicates the inability to
  763.      perform the arithmetic operation requested.
  764. `REAL_VALUE_NEGATE (X)'
  765.      A macro for a C expression which returns the negative of the
  766.      floating point value X.  Both X and the value of the expression
  767.      have type `REAL_VALUE_TYPE' and are in the target machine's
  768.      floating point representation.
  769.      There is no way for this macro to report overflow, since overflow
  770.      can't happen in the negation operation.
  771. `REAL_VALUE_TRUNCATE (MODE, X)'
  772.      A macro for a C expression which converts the floating point value
  773.      X to mode MODE.
  774.      Both X and the value of the expression are in the target machine's
  775.      floating point representation and have type `REAL_VALUE_TYPE'.
  776.      However, the value should have an appropriate bit pattern to be
  777.      output properly as a floating constant whose precision accords
  778.      with mode MODE.
  779.      There is no way for this macro to report overflow.
  780. `REAL_VALUE_TO_INT (LOW, HIGH, X)'
  781.      A macro for a C expression which converts a floating point value X
  782.      into a double-precision integer which is then stored into LOW and
  783.      HIGH, two variables of type INT.
  784. `REAL_VALUE_FROM_INT (X, LOW, HIGH)'
  785.      A macro for a C expression which converts a double-precision
  786.      integer found in LOW and HIGH, two variables of type INT, into a
  787.      floating point value which is then stored into X.
  788.